package com.boge.modules.ssgf.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.boge.modules.ssgf.entity.MaintenanceEntity;
import com.boge.modules.ssgf.service.MaintenanceService;
import com.boge.common.utils.PageUtils;
import com.boge.common.utils.R;



/**
 * 
 *
 * @author boge
 * @email dengpbs@163.com
 * @date 2024-12-20 23:40:41
 */
@RestController
@RequestMapping("ssgf/maintenance")
public class MaintenanceController {
    @Autowired
    private MaintenanceService maintenanceService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("ssgf:maintenance:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = maintenanceService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("ssgf:maintenance:info")
    public R info(@PathVariable("id") Integer id){
		MaintenanceEntity maintenance = maintenanceService.getById(id);

        return R.ok().put("maintenance", maintenance);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("ssgf:maintenance:save")
    public R save(@RequestBody MaintenanceEntity maintenance){
		maintenanceService.save(maintenance);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("ssgf:maintenance:update")
    public R update(@RequestBody MaintenanceEntity maintenance){
		maintenanceService.updateById(maintenance);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("ssgf:maintenance:delete")
    public R delete(@RequestBody Integer[] ids){
		maintenanceService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
